package cn.fws.meap.user.web;

import java.util.List;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import cn.fws.meap.user.entity.Browse;
import cn.fws.meap.user.service.IBrowseService;
import cn.fws.framework.web.contoller.BaseController;
import cn.fws.framework.web.page.PagingResult;
import cn.fws.framework.web.contoller.JsonResponse;

/**
 * 浏览记录 信息操作处理
 * 
 * @author chenkh
 * @date 2019-03-07
 */
@RestController
@RequestMapping("/meap/browse")
@Api(tags = "浏览记录 信息操作处理")
public class BrowseController extends BaseController{

	@Autowired
	private IBrowseService browseService;
	
	/**
	 * 查询浏览记录列表
	 */
	//@RequiresPermissions("meap:browse:list")
	@ApiOperation(value = "查询浏览记录列表")
	@PostMapping("/list")
	public PagingResult<Browse> list(Browse browse){
		startPage();
        List<Browse> list = browseService.selectList(browse);
		return getPagingResult(list);
	}

	/**
	 * 修改保存浏览记录
	 */
	//@RequiresPermissions("meap:browse:edit")
	@ApiOperation(value = "修改保存浏览记录")
	@ApiImplicitParam(name = "browse", value = "修改保存浏览记录",dataType = "Browse")
	@PutMapping("/edit")
	public JsonResponse editSave(Browse browse)	{		
		return toAjax(browseService.update(browse));
	}
	
	/**
	 * 删除浏览记录
	 */
	//@RequiresPermissions("meap:browse:remove")
	@ApiOperation(value = "删除浏览记录")
	@ApiImplicitParam(name = "ids", value = "根据id删除浏览记录",dataType = "String")
	@DeleteMapping( "/remove")
	public JsonResponse remove(String ids)	{		
		return toAjax(browseService.deleteByIds(ids));
	}
	
}
